<template>
  <div style="">
    <div class="header">
      <van-icon

          name="arrow-left"
          size="1.3rem"
          color="white"
          @click="back"
      />

      <span>热卖商品</span>
    </div>
    <div class="list">
      <van-tabs @click="listChange" offset-top="40px" animated sticky v-model="active">
        <van-tab name="spring" title="春季水果">
          <div class="listHeader">
            热卖TOP10
          </div>
          <div>
            <hot-sale-com></hot-sale-com>
            <hot-sale-com></hot-sale-com>
            <hot-sale-com></hot-sale-com>
            <hot-sale-com></hot-sale-com>
            <hot-sale-com></hot-sale-com>
            <hot-sale-com></hot-sale-com>
            <hot-sale-com></hot-sale-com>
            <hot-sale-com></hot-sale-com>
            <hot-sale-com></hot-sale-com>
            <hot-sale-com></hot-sale-com>
          </div>
        </van-tab>
        <van-tab name="summer" title="夏季水果">
          <div class="listHeader">
            热卖TOP10
          </div>
          <div>
            <hot-sale-com></hot-sale-com>
            <hot-sale-com></hot-sale-com>
            <hot-sale-com></hot-sale-com>
            <hot-sale-com></hot-sale-com>
            <hot-sale-com></hot-sale-com>
            <hot-sale-com></hot-sale-com>
            <hot-sale-com></hot-sale-com>
            <hot-sale-com></hot-sale-com>
            <hot-sale-com></hot-sale-com>
            <hot-sale-com></hot-sale-com>
          </div>
        </van-tab>
        <van-tab name="autumn" title="秋季水果">
          <div class="listHeader">
            热卖TOP10
          </div>
          <div>
            <hot-sale-com></hot-sale-com>
            <hot-sale-com></hot-sale-com>
            <hot-sale-com></hot-sale-com>
            <hot-sale-com></hot-sale-com>
            <hot-sale-com></hot-sale-com>
            <hot-sale-com></hot-sale-com>
            <hot-sale-com></hot-sale-com>
            <hot-sale-com></hot-sale-com>
            <hot-sale-com></hot-sale-com>
            <hot-sale-com></hot-sale-com>
          </div></van-tab>
        <van-tab name="winter" title="冬季水果">
          <div class="listHeader">
            热卖TOP10
          </div>
          <div>
            <hot-sale-com></hot-sale-com>
            <hot-sale-com></hot-sale-com>
            <hot-sale-com></hot-sale-com>
            <hot-sale-com></hot-sale-com>
            <hot-sale-com></hot-sale-com>
            <hot-sale-com></hot-sale-com>
            <hot-sale-com></hot-sale-com>
            <hot-sale-com></hot-sale-com>
            <hot-sale-com></hot-sale-com>
            <hot-sale-com></hot-sale-com>
          </div></van-tab>
      </van-tabs>

    </div>
    <div class="listHeader">
      档口尖货

    </div>
    <fruit-list></fruit-list>
  </div>
</template>

<script>
import hotSaleCom from "@/components/hotSaleCom/hotSaleCom";
import fruitItem from "@/components/fruitList/fruitItem";
import fruitList from "@/components/fruitList/fruitList";
export default {
  name: "hotSale",
  data() {
    return {
      active:1,
      list: [],
      loading: false,
      finished: false,
    };
  },
  methods: {
    //标签改变
    listChange(name,title){
      console.log(name)
    },
    back(){
      this.$router.back()
    },
    onLoad() {
      // 异步更新数据
      // setTimeout 仅做示例，真实场景中一般为 ajax 请求
      setTimeout(() => {
        for (let i = 0; i < 10; i++) {
          this.list.push(this.list.length + 1);
        }

        // 加载状态结束
        this.loading = false;

        // 数据全部加载完成
        if (this.list.length >= 40) {
          this.finished = true;
        }
      }, 1000);
    },
  },



  components:{hotSaleCom,fruitItem,fruitList}
};
</script>

<style lang="less" scoped>
.header {
  position: sticky;
  top: 0;
  left: 0;
  z-index: 999;
  box-sizing: border-box;
  height: 40px;
  width: 100%;
  background: #4bd863;
  font-size: 17px;
  line-height: 40px;
  span {
    color: #fff;
    margin-left: 6px;
  }
}

.listHeader{
  text-align: center;
  height: 35px;
  line-height: 35px;
  color: #4bd863;
  font-size: 18px;
  font-weight: bold;
}
</style>
